/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.TagManager;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class UpdateCustomerTagRelation extends AbstractAction
/*    */ {
/* 23 */   private static Logger logger = Logger.getLogger(AddCustomerTagRelation.class.getName());
/*    */ 
/*    */   public UpdateCustomerTagRelation(AbstractHttpServlet servlet) {
/* 26 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException
/*    */   {
/* 33 */     String tagIds = Util.getURLParameter(request.getParameter("TagIds"));
/* 34 */     int customerId = Util.getURLIntParameter(request
/* 35 */       .getParameter("CustomerId"));
/*    */ 
/* 37 */     response.setContentType("text/html;charset=utf-8");
/* 38 */     PrintWriter out = response.getWriter();
/* 39 */     JSONObject jsonObject = new JSONObject();
/*    */ 
/* 41 */     if (customerId <= 0) {
/* 42 */       jsonObject.put("error", "1");
/* 43 */       logger.warn("customerId <= 0 ");
/* 44 */       out.println(jsonObject);
/* 45 */       out.flush();
/* 46 */       out.close();
/* 47 */       return;
/*    */     }
/* 49 */     User loginUser = super.getLoginUser(request);
/*    */ 
/* 51 */     TagManager tagManager = new TagManager();
/* 52 */     tagManager.update(customerId, tagIds, loginUser.companyId, 
/* 53 */       loginUser.userId);
/* 54 */     jsonObject.put("error", "0");
/* 55 */     out.println(jsonObject);
/* 56 */     out.flush();
/* 57 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.UpdateCustomerTagRelation
 * JD-Core Version:    0.6.1
 */